const config = require("../../config/index")

Page({

  /**
   * 页面的初始数据
   */
  data: {
    check: false,
    baseUrl: config.baseUrl,
    theme: wx.getStorageSync('InvoiceLoanTheme') || ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      theme: wx.getStorageSync('InvoiceLoanTheme') || ''
    })
  },
  handleChecked(){
    this.setData({
      check: !this.data.check
    })
  },
  handleAuth(){
    if(!this.data.check){
      wx.showToast({
        title: '请先阅读并勾选协议',
        icon:'error'
      })
      return
    }
    const customerInfoStr = wx.getStorageSync('InvoiceLoanCustomerInfo')
    const customerInfo = JSON.parse(customerInfoStr || '{}')
    wx.startFacialRecognitionVerify({
      name: customerInfo.userName,
      idCardNumber: customerInfo.idCardNo,
      success(res){
        console.log('res.verifyResult',res.verifyResult);
        wx.navigateTo({
          url: '/pages/applicationDetail/index',
        })
      },
      fail(e){
        console.log('err',e);
      }
    })
  }
})